<%--
  Created by IntelliJ IDEA.
  User: owner
  Date: 2018-08-04
  Time: 17:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@include file="../../include/back/BackHeader.jsp"%>
<%@include file="../../include/back/BackNavigator.jsp"%>
<title>产品管理</title>
<div class="Back_Productlist">
    <ol class="breadcrumb">
        <li><a href="admin_category_list">所有分类</a></li>
        <li><a href="admin_product_list?cid=${category.id}">${category.name} </a></li>
        <li class="active">产品管理</li>
    </ol>
    <span hidden <c:if test="${!empty param.delete}"> class="nodelete" </c:if> id="deleteSpan">
    </span>
    <table class="table table-bordered table-hover table-striped table-condensed Back_productlist_table">
        <thead>
        <tr>
            <th>ID</th>
            <th>图片</th>
            <th>产品名称</th>
            <th>产品小标题</th>
            <th>原价格</th>
            <th>优惠价格</th>
            <th>库存数量</th>
            <th>图片管理</th>
            <th>设置属性</th>
            <th>编辑</th>
            <th>删除</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${products}" var="pro" varStatus="st">
            <tr>
                <td>${pro.id}</td>
                <td>
                    <c:if test="${!empty pro.firstProductImage}">
                      <img width="40px" src="img/productSingle/${pro.firstProductImage.id}.jpg">
                    </c:if>
                </td>
                <td>${pro.name}</td>
                <td>${pro.subTitle}</td>
                <td>${pro.orignalPrice}</td>
                <td>${pro.promotePrice}</td>
                <td>${pro.stock}</td>
                <td><a href="admin_productImage_list?cid=${category.id}&pid=${pro.id}"><span class="glyphicon glyphicon-picture"></span></a></td>
                <td><a href="admin_propertyValue_edit?cid=${category.id}&pid=${pro.id}"><span class="glyphicon glyphicon-edit"></span></a></td>
                <td><a href="admin_product_edit?cid=${category.id}&pid=${pro.id}"><span class="glyphicon glyphicon-edit"></span></a></td>
                <td><a href="admin_product_delete?cid=${category.id}&pid=${pro.id}" deleteLink="true"><span class="glyphicon glyphicon-trash"></span></a></td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>
<div class="Back_Productadd">
    <div class="panel panel-default">
        <div class="panel-heading">新增产品</div>
        <div class="panel-body">
            <form  action="admin_product_add" method="post" id="product_form">
                <table class="addTable">
                    <tr>
                        <td> <label for="product_name">产品名称</label></td>
                        <td> <input type="text" id="product_name"  name="product_name" ></td>
                    </tr>
                    <tr>
                        <td> <label for="product_subtitle">产品小标题</label></td>
                        <td> <input type="text" id="product_subtitle"  name="product_subtitle" ></td>
                    </tr>
                    <tr>
                        <td> <label for="product_oprice">原价格</label></td>
                        <td> <input type="text" id="product_oprice"  name="product_oprice" ></td>
                    </tr>
                    <tr>
                        <td> <label for="product_nprice">优惠价格</label></td>
                        <td> <input type="text" id="product_nprice"  name="product_nprice" ></td>
                    </tr>
                    <tr>
                        <td> <label for="product_stock">库存</label></td>
                        <td> <input type="text" id="product_stock"  name="product_stock" ></td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <button class="btn btn-success" type="submit" id="product_addbutton">提交</button>
                        </td>
                        <td>
                            <input type="hidden" name="cid" value="${category.id}">
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<%@include file="../../include/back/BackPage.jsp"%>
<%@include file="../../include/back/BackFooter.jsp"%>
